#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;
LL res[31][31];
LL f[31];
LL C(LL a, LL b) {
	if (b>a-b) b=a-b;
	if (b==0) return 1;
	if (b<0||b>a) return 0;
	LL ans=1;
	for (int i=0; i<b; ++i) {
		ans=ans*(a-i)/(i+1);
	}
	return ans;
} 
void Init() {
	memset(res, 0, sizeof(res));
	f[1]=1;
	for (int i=0; i<31; ++i) res[i][0]=1, res[i][1]=1;
	res[0][1]=0;
	for (int i=1; i<31; ++i) {
		for (int j=2; j<31; ++j) {
			for (int p=0; p*i<=j; ++p) {
				res[i][j]+=C(f[i]+p-1, p)*res[i-1][j-p*i];
			}
		}
		f[i+1]=res[i][i+1];
	}
}
int main() {
	Init();
	int ask;
	while (cin>>ask&&ask) {
		printf("%lld\n", (ask==1? 1: 2*f[ask]));
	}
	return 0;
} 
